#include <stdio.h>
#include "header.h"

#define FIELD(TYPE, MEMBER)   \
    {#TYPE, sizeof(TYPE), #MEMBER, sizeof_field(struct fields ,MEMBER), offsetof(struct fields ,MEMBER),},
static const struct field_desc descs[] =
{
#define __START_HEADER_H
#include "_header.h"
};

static void print_desc1(void)
{
    int i;
    printf("%s:%d\n", __func__, __LINE__);
    for (i = 0; i < ARRAY_SIZE(descs); i++) {
        const struct field_desc *d = &descs[i];
        printf("%d -> %15s: %lu, %5s: %lu, offset: %lu\n",
            i, d->type, d->sz_type, d->member, d->sz_member, d->offset);
    }
}

static void print_desc2(void)
{
    printf("%s:%d\n", __func__, __LINE__);
#define FIELD(TYPE, MEMBER)   \
    printf("%d -> %15s: %lu, %5s: %lu, offset: %lu\n", \
        field_ ##MEMBER, #TYPE, sizeof(TYPE), #MEMBER, sizeof_field(struct fields ,MEMBER), offsetof(struct fields ,MEMBER));
#define __START_HEADER_H
#include "_header.h"
}


int main(void)
{
    print_desc1();
    print_desc2();
    return 0;
}